<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/jquery-3.6.0.js" type="text/javascript"></script>
	</head>
	<body>
		<div id="d0">
			<div id="d1">div1</div>
			<div id="d2">div2</div>
			<div id="d3">
				<div id="d31">d31</div>
			</div>
			<div id="d4">div4</div>
		</div>
		<script type="text/javascript">
			//-------children所有子元素的元素集合--------------------------------------------
			$('#d0').children().css("font-size", "20px");
			$('#d0').children("#d2").css("font-size", "50px");

			//--------parent唯一父元素-------------------------------------------------------------------
			let d31Parent = $('#d31').parent();
			// console.log(d31Parent);

			//--------parents所有父元素---------------------------------------------------------
			let d31Parents = $('#d31').parents("#d0");
			// console.log(d31Parents);

			//--------prev紧邻的前一个同辈元素--------------------------------------------------------------------
			let d2Prev = $('#d2').prev();
			// console.log(d2Prev);

			//--------prevAll之前所有的同辈元素--------------------------------------------------------------------
			let d3PrevAll = $('#d3').prevAll("#d1");
			// console.log(d3PrevAll);

			//--------siblings同辈元素----------------------------------------------------------------------------
			let d3Siblings = $('#d3').siblings();
			// console.log(d3Siblings);

			//---------find搜索所有与指定表达式匹配的元素---------------------------------------------------------------------------------------
			let d31 = $('#d0').find("#d31");
			console.log(d31);
		</script>
	</body>
</html>
